package com.hu.state;

/**
 * @author 00355760
 * @功能：
 * @版本： V1
 * @版权： 信息技术有限公司（http://www.mychery.com/）
 * @作者： 磐石战队开发组  00355760
 * @日期： 2024/9/19 15:38
 */
//线程优先级 1-10
public class PriorityTest implements Runnable{
    public static void main(String[] args) {
        PriorityTest myPriority = new PriorityTest();
        Thread t1 = new Thread(myPriority);
        Thread t2 = new Thread(myPriority);
        Thread t3 = new Thread(myPriority);
        Thread t4 = new Thread(myPriority);
        Thread t5 = new Thread(myPriority);
        t2.setPriority(5);
        t3.setPriority(4);
        t4.setPriority(Thread.MAX_PRIORITY);
        t5.setPriority(8);
        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"-->"+Thread.currentThread().getPriority());
    }
}

